package com.app.controller;

import com.app.conf.RedisService;
import com.app.model.LiveRecordModel;
import com.app.model.UserModel;
import com.app.service.LiveService;
import com.app.service.UserService;
import com.app.util.CommonHelp;
import com.app.util.Result;
import com.app.util.TencentYunVedioUtil;
import com.app.util.TokenUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;

public class liveNewController {

    @Autowired
    private RedisService redisService;

    @Autowired
    UserService userService;

    @Autowired
    LiveService liveService;

    @PostMapping("createPushUrl")//生成推流地址
    public static String createPushUrl() {

        //过期时间 16进制的unix时间戳

        String txTime = TencentYunVedioUtil.to16Hex(TencentYunVedioUtil.addOneDay());

        // 填写自己的streamName

        String streamName="xxxxx";

        StringBuffer sb = new StringBuffer();

        String pushUrlHead=TencentYunVedioUtil.pushUrl;

        // String stream_id = TencentYunVedioUtil.bizid();

        sb.append(pushUrlHead).append("?").append("txSecret=").append(TencentYunVedioUtil.genSign(TencentYunVedioUtil.push_key, streamName,txTime)).append("&").append("txTime=")
        .append(txTime);


        return sb.toString();

    }



}
